#include <bits/stdc++.h>
using namespace std;
const int MAXN=1e5+10;
int cnt[MAXN];
int a[MAXN];
deque<int> q;
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
        cnt[a[i]]++;
    }
    sort(a+1,a+1+n);
    int len=unique(a+1,a+1+n)-a-1;
    for(int i=1;i<=len;i++){
        for(int k=1;k<=cnt[a[i]];k++){
            if(!q.empty()&&a[i]>q.back()) {
                cnt[q.back()]--;
                if(!q.empty()&&cnt[q.back()]==0) q.pop_back();
            }
        }
        q.push_back(a[i]);
    }
    int ans=0;
    while(!q.empty()){
        ans+=cnt[q.back()];
        q.pop_back();
    }
    printf("%d\n",ans);
    return 0;
}
